﻿namespace NoIdeaIoc;
/// <summary>
/// 最小注入容器接口单元
/// </summary>
interface IResolveUnit
{
    /// <summary>
    /// 是否泛型定义类(不可直接实例化)
    /// </summary>
    bool IsGenericTypeDefinition { get; }
    /// <summary>
    /// 生命周期类型
    /// </summary>
    ServiceLifetime ServiceLifetime { get; }
    /// <summary>
    /// 判断是否缓存键一致
    /// </summary>
    /// <param name="keyName"></param>
    /// <returns></returns>
    bool EqualKeyName(string keyName);
    /// <summary>
    /// 获取对象的实例
    /// </summary>
    /// <param name="lifeTime"></param>
    /// <param name="keyName"></param>
    /// <returns></returns>
    object? ResolveInstance(ILifeTime lifeTime, string keyName);
    /// <summary>
    /// 获取泛型对象实例
    /// </summary>
    /// <param name="lifeTime"></param>
    /// <param name="genericArgumentTypes"></param>
    /// <param name="keyName"></param>
    /// <returns></returns>
    IocResponse? ResolveInstance(ILifeTime lifeTime, Type[] genericArgumentTypes, string keyName);
}